package com.wntms.wgj.dao;

import com.wntms.wgj.pojo.FreightContracts;
import com.wntms.wgj.pojo.FreightLines;
import com.wntms.wgj.pojo.FreightStatus;
import org.apache.ibatis.annotations.*;

@Mapper
public interface FreightContractDaos {
    /**
     * 根据货运单合同id查询货运单合同对象
     * @param id
     * @return
     */
    @Select("select * from freight_contract where fid = #{id}")
    @Results({
            @Result(id = true,property = "id",column = "id"),
            @Result(property = "fid",column = "fid"),
            @Result(property = "flid",column = "flid"),
            @Result(property = "fid",column = "fid"),
            @Result(property = "fare",column = "fare"),
            @Result(property = "insurancefare",column = "insurancefare"),
            @Result(property = "auditstatus",column = "auditstatus"),
            @Result(property = "pay",column = "pay"),
            @Result(property = "sdate",column = "sdate"),
            @Result(property = "fiid",column = "fiid"),
            @Result(property = "uid",column = "uid"),
            @Result(property = "coid",column = "coid"),
            @Result(property = "fsid",column = "fsid"),
            @Result(property = "occurtime",column = "occurtime"),
            @Result(property = "refundtype",column = "refundtype"),
            @Result(property = "payment",column = "payment"),
            @Result(property = "freightLines",column = "flid",javaType = FreightLines.class,
                    one = @One(select = "com.wntms.wgj.dao.FreightLineDaos.findById")),
            @Result(property = "freightStatus",column = "fsid",javaType = FreightStatus.class,
                    one = @One(select = "com.wntms.wgj.dao.FreightStatusDao.findById"))
    })
    public FreightContracts findById(String id);

    @Update("update freight_contract set refundtype = #{refundtype} where fid = #{id}")
    public int updateRe(FreightContracts freightContracts);
}
